home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Utilities Professional 1-1500
/
Utilities Professional 1-1500 (1994)(WPD)[!].iso
/
12511500
/
var1308.dms
/
var1308.adf
/
DNET2_10.LHA
/
DNet
/
Amiga
/
Sourcen.lha
/
doshand
/
uuser.doc
< prev
Wrap
Text File
|
1993-01-14
|
2KB
|
67 lines
UUSER.DOC
UUSER V1.00 Beta
Currently UUSER: works only with single sessions started
by Getty (this has to do with how UUSER: deals with carrier
detect). THIS WILL BE FIXED.
Openning UUSER:
fopen("UUSER:devicename/unit/options", ...);
Example:
(suggested)
int fd = open("UUSER:serial.device/0/R1000", O_RDWR | O_CREAT | O_TRUNC);
(also can do this -- see below for problems using
stdio to read)
FILE *rfi = fopen("UUSER:serial.device/0/R1000", "r");
FILE *wfi = fopen("UUSER:serial.device/0/R1000", "w");
Features:
* 1K asynchronous write buffer for each file handle. I.E.
your write() will return when 1K or less remains to be
written (UUSER: has a 1K buffer for spooling these per
file handle)
* selectable read timeout
* read poll
* carrier lost handling
General:
(1) Use Level 1 I/O if you can (read/write)
read() returns 0 on timeout, -1 on carrier lost
otherwise, read() returns the immediate number of
data bytes ready up to the amount you requested.
(i.e. if you read(0,buf,256) you can get anywhere from
-1, 0, 1 to 256 back).
write() returns the number you wrote or -1 (lost carrier)
To 'poll' data ready you can read(0, NULL, 0) .. reading
0 bytes returns 0 (data ready) or -1 (data not ready).
NOTE: 0 (data ready) will be returned if carrier is lost
when you read 0 bytes... this is so your program thinks
data is ready and when it does a real read it finds that
carrier was lost!
(2) If you want to use Level 2 I/O (stdio) I suggest you use
it for writing only. If you really want to use it for
reading remember that the timeout will cause an EOF
condition which must be cleared (clrerr()). And you
must call ferror() to determine whether an EOF is an
EOF (timeout()) or an actual error (lost carrier).
REFER TO UUSERDUMP.C for a working source example.